<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Happy dong
 * Created Time: 2019-08-07 16:24
 *
 * Version: 2.0
 */

namespace App\Modules\Employee\Transformers;


use League\Fractal\TransformerAbstract;

class ScheduleTransformer extends TransformerAbstract
{
	private $list;

	public function __construct($list)
	{
		$this->list = $list;
	}

	public function transform()
	{
		if($this->list->isEmpty()) return null;
		foreach ($this->list as $v) {
			$result['date'] = date('Y-m', $v->plan_date);
			$result['days'][] = date('j', $v->plan_date);
		}
		return $result;
	}
}
